# _*_ coding : utf-8 _*_
# @Time: 2024/10/11 11:35
# @Author : 石文帅	
# @File : testcase05指标考核分析.py
# @Project : python_slfh


from server.slfhWorkbench import *
from selenium.webdriver.chrome.service import Service
from xpathDictionary.slfhXpath import *


class test(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        cls.wd = webdriver.Chrome(service=Service(driver_path))
        cls.wd.get(url_path)
        cls.wd.maximize_window()
        login(cls.wd)

    @classmethod
    def tearDownClass(cls):
        cls.wd.quit()
        log.info('----------------------------------------------------------')

    def testcase05指标考核分析(self):
        """
        指标考核分析
        :return:
        """
        log.info('test5_指标考核分析')
        search_menu(self.wd, '指标考核分析')

        log.info('服务年度设置:2024-03')
        locate_click(self.wd, assessment['服务年度设置'])
        locate_input(self.wd, assessment['服务年度设置日期'], '2024-03')
        locate_click(self.wd, assessment['虚假的选择时间按钮'])
        locate_click(self.wd, assessment['服务年度设置确定'])

        log.info('搜索2024年 第二季度')
        locate_click(self.wd, assessment['年份下拉'])
        locate_click(self.wd, assessment['2024'])
        locate_click(self.wd, assessment['季度下拉'])
        locate_click(self.wd, assessment['第二季度'])
        time.sleep(1)

        log.info('断言2024年第二季度的各项分数')
        actualise = ['68分', '0.02分', '0分', '0分', '10分', '3.2分', '0分', '33分']
        assert_list_elements(self.wd, assessment['分数list'], actualise)

        log.info('断言扣分明细说明中的重要时间段扣分和一般时间段扣分')
        locate_click(self.wd, assessment['扣分明细说明'])
        time.sleep(1)
        assert_equal(locate_text(self.wd, assessment['重要时间段扣分']), '扣分：40 分')
        assert_equal(locate_text(self.wd, assessment['一般时间段扣分']), '扣分：28 分')
        locate_click(self.wd, assessment['关闭扣分明细说明'])
        locate_click(self.wd, assessment['服务年度设置'])
        locate_input(self.wd, assessment['服务年度设置日期'], '2024-01')
        locate_click(self.wd, assessment['虚假的选择时间按钮'])
        locate_click(self.wd, assessment['服务年度设置确定'])
